json_schema = {
    "title": "公司信息",
    "description": "公司基本信息",
    "type": "object",
    "properties": {
        "company_name": {
            "type": "string",
            "description": "公司名称",
        },
        "industry": {
            "type": "string", 
            "description": "所属行业",
        },
        "employee_count": {
            "type": "integer",
            "description": "员工总数",
            "default": None,
        },
    },
    "required": ["company_name", "industry"],
}

from langchain_ollama import ChatOllama
llm = ChatOllama(model="qwen3:8b", temperature=0.5, reasoning=False)
structured_llm = llm.with_structured_output(json_schema)

result = structured_llm.invoke("分析一下腾讯公司")
print(result)
# 输出: {'company_name': '腾讯', 'industry': '互联网科技', 'employee_count': 110715}